package com.mobimagic.lockscreen.remaintime.aidl;

import java.util.ArrayList;
import java.util.List;

import android.os.Parcel;
import android.os.Parcelable;

public class ChargingDatas implements Parcelable {
    public long startTime;
    public int lastBattery = -2;
    public long lastBatteryTime;
    public int scaleBattery;
    public long endTime;
    public ArrayList<ChargingData> chargingDatas;

    public ChargingDatas() {
        chargingDatas = new ArrayList<ChargingData>(100);
    }

    public List<ChargingData> getChargingDatas() {
        return chargingDatas;
    }

    public int getScaleBattery() {
        return scaleBattery;
    }

    public void setScaleBattery(int scaleBattery) {
        this.scaleBattery = scaleBattery;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeLong(lastBatteryTime);
        dest.writeLong(startTime);
        dest.writeLong(endTime);
        dest.writeInt(lastBattery);
        dest.writeInt(scaleBattery);
        dest.writeList(chargingDatas);
    }

    public static final Parcelable.Creator<ChargingDatas> CREATOR = new Creator<ChargingDatas>() {
        @Override
        public ChargingDatas[] newArray(int size) {
            return new ChargingDatas[size];
        }

        @SuppressWarnings("unchecked")
        @Override
        public ChargingDatas createFromParcel(Parcel source) {
            ChargingDatas chargingDatas = new ChargingDatas();
            chargingDatas.lastBatteryTime = source.readLong();
            chargingDatas.startTime = source.readLong();
            chargingDatas.endTime = source.readLong();
            chargingDatas.lastBattery = source.readInt();
            chargingDatas.scaleBattery = source.readInt();
            chargingDatas.chargingDatas = source.readArrayList(ChargingData.class.getClassLoader());
            return chargingDatas;
        }
    };

}
